"""myblog URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url ,include
from django.contrib import admin
from article import views

from DjangoUeditor import urls as DjangoUeditor_urls
from django.conf import settings


urlpatterns = [
    #url(r'^admin/', admin.site.urls),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', views.home, name="home"),   #主页
    url(r'^about/', views.about, name="about"),   #关于我
    url(r'^archive/$', views.archive, name="archive"),  # 归档
    url(r'^message/$',views.message, name="message"),#留言
    url(r'^feed/$', views.RSSFeed(), name = "RSS"),  #新添加的urlconf, 并将name设置为RSS, 方便在模板中使用
    url(r'^article/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<id>\d+)/$', views.detail,name="detail"),  #文章详情页
    url(r'^article/(?P<year>\d{4})/(?P<month>\d{1,2})/$', views.archive_month, name="archive_month"),  # 按月归档
    url(r'^articleClassfi/(?P<classfi>\w+)/$', views.classfiDetail, name="classfiDetail"),  # 每个分类页下面的文章
    url(r'^articleTag/(?P<tag>\w+)/$', views.tagDetail, name="tagDetail"),

    url(r'^ueditor/', include(DjangoUeditor_urls)),

]

if settings.DEBUG:
    from django.conf.urls.static import static

    urlpatterns += static(
        settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
